using System;
using System.Windows.Forms;
using Ninject;
using Liquid.Windows;
using System.Net;
using System.ComponentModel;
using Microsoft.Practices.ServiceLocation;
using CommonServiceLocator.NinjectAdapter;
using System.Collections.Generic;
using Ninject.Parameters;
using NTweet.HttpService;
using NTweet.MockTwitterApi;

namespace NTweet.Krypton {
	static class Program {
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() {
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			var kernel = new StandardKernel();
			var locator = new NinjectServiceLocator(kernel);
			ServiceLocator.SetLocatorProvider(() => locator);
#if DEBUG
			kernel.Bind<IHttpRequestFactory>().To<MockHttpRequestFactory>();
#else
			kernel.Bind<IHttpRequestFactory>().To<HttpRequestFactory>();
#endif
			kernel.Bind<Client>().ToSelf();
			kernel.Bind<Form>().To<MainForm>();
			kernel.Bind<ViewListBase>()
				.To<FriendsViewList>()
				.Named("list-friends")
				.WithParameter(new Parameter("order", 10, false))
				;
			kernel.Bind<ViewListBase>()
				.To<FeedsViewList>()
				.Named("list-feeds")
				.WithParameter(new Parameter("order", 0, false))
				;
			var tray = kernel.Get<TrayApplicationContext>();
			tray.ApplicationName = "NTweet.Krypton";
			tray.Animate = true;
			tray.AlwaysShowInTray = true;
			Application.Run(tray);
		}
	}
}